/*
 * @Title MyAdapterWithCommViewHolder.java
 * @Copyright Copyright 2010-2015 Yann Software Co,.Ltd All Rights Reserved.
 * @Description��
 * @author Yann
 * @date 2015-8-5 ����10:03:45
 * @version 1.0
 */
package com.zhaorenxueapp.LIstView;

import android.content.Context;

import com.zhaorenxueapp.R;
import com.zhaorenxueapp.Xutils.Person;

import org.xutils.image.ImageOptions;
import org.xutils.x;

import java.util.List;

/**
 * 类注释
 *
 * @author Yann
 * @date 2015-8-5 下午10:03:45
 */
public class MyAdapterWithCommViewHolder extends CommonAdapter<Bean> {
    public ViewHolder holder;
    private Context context;
    private ImageOptions options;
    private List<Person> list;

    public MyAdapterWithCommViewHolder(Context context, List<Bean> datas, int layoutId) {
        super(context, datas, layoutId);
    }

    /**
     * 实现public abstract View getView(int position, View convertView, ViewGroup parent);
     * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
     */
/*	@Override
    public View getView(int position, View convertView, ViewGroup parent)
	{
		ViewHolder holder = ViewHolder.get(mContext, convertView, parent, R.layout.item, position);
		Bean bean = mDatas.get(position);

		((TextView)holder.getView(R.id.tv_title)).setText(bean.getTitle());
		((TextView)holder.getView(R.id.tv_desc)).setText(bean.getDesc());
		((TextView)holder.getView(R.id.tv_time)).setText(bean.getTime());
		((TextView)holder.getView(R.id.tv_phone)).setText(bean.getPhone());

		return holder.getConvertView();
	}
*/

    /**
     * 实现public abstract void convert(ViewHolder holder, T t);
     *
     * @see com.imooc.baseadapter.utils.CommonAdapter#convert(com.imooc.baseadapter.utils.ViewHolder, java.lang.Object)
     */
    @Override
    public void convert(ViewHolder holder, final Bean bean) {
        holder
                .setImageResource(R.id.tv_title,bean.getImgUrl())
                .setText(R.id.tv_desc, bean.getDesc())
                .setText(R.id.tv_time, bean.getTime())
                .setText(R.id.tv_phone, bean.getPhone());
//		final CheckBox cBox = (CheckBox)(holder.getView(R.id.cd));
//		if (cBox != null) {
//			cBox.setChecked(bean.isChecked());
//
//			cBox.setOnClickListener(new OnClickListener()
//			{
//				@Override
//				public void onClick(View v)
//				{
//					bean.setChecked(cBox.isChecked());
//				}
//			});
//		}
    }
}
